package org.huaxi.support;

/**
 * Created by huwei on 2019/5/10.
 */
public class NamedThreadLocal<T> extends ThreadLocal<T> {

  private final String name;

  /**
   * Create a new NamedThreadLocal with the given name.
   *
   * @param name a descriptive name for this ThreadLocal
   */
  public NamedThreadLocal(String name) {
    if (null == name || name.length() == 0) {
      throw new IllegalArgumentException("Name must not be empty");
    }
    this.name = name;
  }

  @Override
  public String toString() {
    return this.name;
  }
}
